package ma.cdm.compteRendu.bo;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * Membrecomite entity. @author Limouri Anouar
 */
@Entity
@Table(name="membrecomite")

public class MembreComite  implements java.io.Serializable {

	// Fields

     private String matricule;
     private Integer  ordre;
     private Set<CompteRendu> compteRendus = new HashSet<CompteRendu>(0);
     private Set<CompteRendu> compteRendus_1 = new HashSet<CompteRendu>(0);
     private Set<PersonneRole> personneRoles = new HashSet<PersonneRole>(0);


    // Constructors

    /** default constructor */
    public MembreComite() {
    }

	/** minimal constructor */
    public MembreComite(String matricule) {
        this.matricule = matricule;
    }
    
    
    public MembreComite(String matricule, int ordre) {
		super();
		this.matricule = matricule;
		this.ordre = ordre;
	}

	/** full constructor */
    public MembreComite(String matricule, Set<CompteRendu> compteRendus, Set<CompteRendu> compteRendus_1, Set<PersonneRole> personneRoles) {
        this.matricule = matricule;
        this.compteRendus = compteRendus;
        this.compteRendus_1 = compteRendus_1;
        this.personneRoles = personneRoles;
    }

	// Property accessors
	@Id
	@Column(name = "MATRICULE", unique = true, nullable = false, length = 20)
	public String getMatricule() {
		return this.matricule;
	}

	public void setMatricule(String matricule) {
		this.matricule = matricule;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "membrepresent", joinColumns = { @JoinColumn(name = "MATRICULE", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "IDCOMPTERENDU", nullable = false, updatable = false) })
	public Set<CompteRendu> getCompteRendus() {
		return this.compteRendus;
	}

	public void setCompteRendus(Set<CompteRendu> compterendus) {
		this.compteRendus = compterendus;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "membrecomites")
	public Set<CompteRendu> getCompteRendus_1() {
		return this.compteRendus_1;
	}

	public void setCompteRendus_1(Set<CompteRendu> compterendus_1) {
		this.compteRendus_1 = compteRendus_1;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "membreComite")
	public Set<PersonneRole> getPersonneRoles() {
		return this.personneRoles;
	}

	public void setPersonneRoles(Set<PersonneRole> personneroles) {
		this.personneRoles = personneroles;
	}
 
	@Column(name="ordre", nullable=true, length=10)
	public void setOrdre(Integer  ordre) {
		this.ordre = ordre;
	}

	public Integer getOrdre() {
		return ordre;
	}
   
    

}